package cn.com.fig.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface TradeSysMapper {

	/**
	 * 分页方式查询数据
	 * @return
	 */
	List<Map<String,Object>> listTradeSys();
	
	@Insert("INSERT INTO	t_trade_sys(sysName,sysUrl,sysIcon,sysStatus,sysLevel,AccessMode,sysId) VALUES("
			+ "#{sysName, jdbcType=VARCHAR},#{sysUrl, jdbcType=VARCHAR},#{sysIcon, jdbcType=VARCHAR},"
			+ "#{sysStatus, jdbcType=CHAR},#{sysLevel, jdbcType=INTEGER},#{AccessMode, jdbcType=CHAR},#{sysId, jdbcType=VARCHAR});")
	int insert(Map<String, Object> map);
	
	@Update("UPDATE t_trade_sys SET sysName = #{sysName, jdbcType=VARCHAR},sysUrl = #{sysUrl, jdbcType=VARCHAR},"
			+ "sysIcon=#{sysIcon, jdbcType=VARCHAR},sysStatus = #{sysStatus, jdbcType=CHAR},sysLevel = #{sysLevel, jdbcType=INTEGER},"
			+ "AccessMode = #{AccessMode, jdbcType=CHAR} where sysId = #{sysId, jdbcType=VARCHAR}")
	int update(Map<String, Object> map);
	
	@Delete("delete from t_trade_sys where sysId = #{sysId}")
	int delete(@Param("sysId") String sysId);
}
